﻿Imports System.Net.Mail
Public Class frm_sukien

    Private Sub cmd_gui_Click(sender As System.Object, e As System.EventArgs) Handles cmd_gui.Click
        Try
            Dim tieude As String = txt_tieude.Text
            Dim noidung As String = txt_noidung.Text
            Dim em As String = txt_mail.Text
            Dim mailbody As String = noidung
            Dim mail As New MailMessage
            mail.From = New MailAddress("thanhqui_1994@yahoo.com")
            mail.To.Add(em)
            mail.Subject = tieude
            mail.Body = mailbody
            mail.IsBodyHtml = True
            Dim smtp = New SmtpClient("smtp.mail.yahoo.com", 587)
            smtp.Credentials = New Net.NetworkCredential("thanhqui_1994@yahoo.com", "Do@nPh@nM3m")
            smtp.EnableSsl = True
            smtp.Send(mail)
            MsgBox("Mail đã được gửi")
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
End Class